package sg.edu.nus.dbd.dao;

public abstract class DAOFactory {

	public abstract DashboardDAO getDashboardDAO() throws DAOException;

	public abstract ConfigurationDAO getConfigurationDAO() throws DAOException;

	public abstract SQLDebugDAO getSQLDebugDAO() throws DAOException;

	private static DAOFactory instance;
	// the default implementation for DBDashboard DAO
	private static int ACCESSCONFIG = 1;

	public static DAOFactory getInstance() {

		instance = loadInstance(ACCESSCONFIG);

		return instance;
	}

	public static DAOFactory getInstance(int i) {

		instance = loadInstance(i);

		return instance;
	}

	private static DAOFactory loadInstance(int acc) {

		// For now, there is only JDBC implementation for DBDashboard DAO
		switch (acc) {
		case (1):
			return new sg.edu.nus.dbd.dao.jdbc.DAOFactoryImpl();
		default:
			return new sg.edu.nus.dbd.dao.jdbc.DAOFactoryImpl();
		}
	}
}